// if the path ends with main.rs it is probably a directory, but it can also be
// a file directly inside src/bin
if parent.ends_with("src/bin") {
- // This would always return name "main"
- // Fixme: Is this what we want? based on what @matklad said, I don't think so
- // bin.file_stem().and_then(|s| s.to_str()).map(|f| f.to_string())
-
- // This seems to be the right solution based on the inferred_bin_paths function
- Some(name.to_string())
+ // This will always return name "main"
+ bin.file_stem().and_then(|s| s.to_str()).map(|f| f.to_string())
} else {
parent.file_stem().and_then(|s| s.to_str()).map(|f| f.to_string())
}
.file("src/bin/foo.rs", "fn main() {}")
.file("src/bin/foo/main.rs", "fn main() {}");
- // TODO: This should output the error from toml.rs:756
- assert_that(p.cargo_process("build"), execs().with_status(101));
+ assert_that(p.cargo_process("build"),
+ execs().with_status(101)
+ .with_stderr_contains("\
+[..]found duplicate binary name foo, but all binary targets must have a unique name[..]
+"));
}
#[test]